using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace VirtualDeveloper.Filters
{
    public class RandomEnumerator<T> : IEnumerator<T>
    {
        private readonly IList<T> list;
        private readonly int count;
        private readonly Random random = new Random();

        public RandomEnumerator(IList<T> list)
        {
            this.list = list;
            count = list.Count();
        }

        public void Dispose()
        {

        }

        public bool MoveNext()
        {
            return true;
        }

        public void Reset()
        {

        }

        public T Current { get { return list[random.Next(0, count - 1)]; } }

        object IEnumerator.Current
        {
            get { return Current; }
        }
    }
}